/*
 * @Description: 提示标签
 * @Author: iamsmiling
 * @Date: 2021-06-06 10:45:57
 * @LastEditTime: 2021-06-06 10:50:47
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:flutter/material.dart';

class TextFieldLableTip extends StatelessWidget {
  final String label;
  final bool isRequired;
  final Function()? showDemo;
  const TextFieldLableTip(
      {Key? key, required this.label, this.isRequired = true, this.showDemo})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Container(
          margin: EdgeInsets.only(right: R.dimen.dp10),
          child: Text.rich(TextSpan(
              text: label,
              style: TextStyle(fontSize: R.dimen.sp13, color: R.color.ff333333),
              children: [
                TextSpan(
                    text: isRequired ? "*" : "",
                    style: TextStyle(
                        fontSize: R.dimen.sp12, color: R.color.ffe72038))
              ])),
        ),
        Visibility(
          visible: showDemo != null,
          child: GestureDetector(
            onTap: showDemo,
            child: Text(
              "示例",
              style: TextStyle(fontSize: R.dimen.sp12, color: R.color.ff099ee4),
            ),
          ),
        ),
      ],
    );
  }
}
